#!/bin/bash

path="/home/melonli/exp/bin2"
sudo killall sinet >/dev/null 2>&1
sudo sysctl -w vm.nr_hugepages=128 >/dev/null &

cpu_num=$1
if [[ "$cpu_num" == "0" ]];then
	exit 0
fi
if [[ "$cpu_num" == "" ]];then
	cpu_num=1
fi
cpu_str='"cpu_threads_conf" :
 [
 '
for i in `seq 0 $((cpu_num-1))`
do
    cpu_str=$cpu_str'\n{ "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" :'" $i },\n"
done
cpu_str=$cpu_str'],'
echo -e  "$cpu_str" >"$path/cpu.txt"


proxychains $path/sinet >/dev/null 2>&1 &

